﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Smart
{
    public class Kullanici : Tablo
    {
        public int Id { get; set; }
        public string Adi { get; set; }
        public string Kodu { get; set; }
        public string Sifre { get; set; }
        public override string ToString()
        {
            return Adi;
        }

        public override IEnumerable<string> BulkImport(int depoNo)
        {
            yield return "İndiriliyor...";
            string[] dt = BackOffice.Get.KullaniciList();
            yield return "indirildi.";
            if (dt != null)
            {
                this.Delete();
            }
            foreach (string item in SqlCeClient.Get.importRows(this.TabloAdi, dt))
            {
                yield return item;
            }
            yield return "Tamamlandı";
        }

        public void Delete()
        {
            SqlCeClient.Get.Exec("DELETE FROM TBL_KULLANICI");
        }

        public Kullanici()
        {
            this.TabloAdi = "TBL_KULLANICI";
        }
    }
}
